@extends('layouts.admin')
@section('title') @parent 用户 @stop
@section('beforeStyle')
{{ HTML::style('lib/css/jquery.ui.datepicker.css') }}
@stop
@section('page_title')@parent
用户
@show
@section('breadcrumb')@parent
{{ Breadcrumbs::render('user-index') }}
@show
@section('content')
<div class="box">
		<div class="box-header">
				<h3 class="box-title">查询筛选</h3>
		</div>
		<div class="box-body table-responsive">	
				@include('widgets.notification')
                @if($user_group_id ==2)
                <div class="pad">
					<div class="btn-group btn-right navbar-right">
							<a href="{{ route('admin.users.addlawyer') }}" class="btn btn-primary" type="button">添加律师</a>
					</div>
				</div>
                @endif
				<div role="grid" class="dataTables_wrapper form-inline">
						{{ Form::open(array('method' => 'GET', 'class'=>'form-inline')) }}
								<input type="text" name="keywords" placeholder="账户/名称/手机号/邮箱" value="{{ $keywords }}"><button class="btn btn-sm btn-default" type="submit">查询</button>
						{{ Form::close() }}
				</div>
				<form class="form-user" autocomplete="off" method="post" action="">
				<input type="hidden" name="_token" value="{{ csrf_token() }}" />
				<table class="table table-bordered table-hover dataTable">
					<thead>
					<tr>
						<th>类型</th>
						<th>名称</th>
						<th>账户</th>
						<th>邮箱</th>
						<th>电话号码</th>
						<th>状态</th>
						<th>注册时间</th>
						<th>更新时间</th>
						<th>操作</th>
					</tr>
					</thead>
					<tbody>
					    @foreach ($datas as $datalist)
								<tr>
									<td>
										{{ $user_group_list[$datalist['user_group_id']] }}
									</td>
									<td>
										{{ isset($datalist['realname']) ? $datalist['realname'] : $datalist['name']; }}
									</td>
									<td>
										{{ $datalist['account'] }}
									</td>
									<td>
									  {{ $datalist['email'] }}
									</td>
									<td>
									  {{ $datalist['phone'] }}
									</td>
									<td>
										<?php
											if ($datalist['status'] == 3) {
												echo '<span class="text-green">已认证</span>';
											} elseif ($datalist['status'] == 2) {
												echo '<span class="text-yellow">已提交认证申请</span>';
											} elseif ($datalist['status'] == 1) {
												echo '<span class="text-red">未认证</span>';
											}
										?>
									</td>
									<td>
									{{ $datalist['created_at'] }}
									</td>
									<td>
									{{ $datalist['updated_at'] }}
									</td>
									<td>
									<?php
									if($datalist['user_group_id']==2) {
									?>
										<a href="{{ route('admin.users.edit', $datalist['id']) }}" name="recommend_user" id="yg_{{$datalist['id']}}">推荐</a>&nbsp;
										<a href="{{ route('admin.users.edit', $datalist['id']) }}" name="edit_user" id="yg_{{$datalist['id']}}">审核</a>&nbsp;
									<?php
									}
									?>
									<a href="{{ route('admin.users.editlawyer', $datalist['id']) }}" name="edit_user" id="yg_{{$datalist['id']}}">编辑</a>&nbsp;
									<a href="javascript:void(0);" class="deluser" data-id="{{ $datalist['id'] }}">删除</a>

							 </tr>
							@endforeach
					</tbody>
				</table>
				</form>
		</div>
		<div class="box-footer clearfix">
				{{ $datas->appends(Input::except('page'))->links() }}
		</div>
</div>
@stop
@section('end')
@parent
<script>
  $('.deluser').on('click', function(){
  
    if(confirm('确定删除该用户么？'))
    {
        var id = $(this).attr('data-id');
        location.href="/admins/users/delete/"+id;
    }
  });
</script>
@stop